Thread: struct mystruct mystruct = { item1: value, . . .

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    Quote Originally Posted by Jesius View Post
    Code:
    struct mystruct {
        int item1, item2, item3, item4, item5, item10; // I think you get the point
    } mystruct = {
           item1: 1,
           item2: 2,
           item5: 5,
           item4: 4,
    };
    you can define a struct like:
    Code:
    struct mystruct {
           item1: 1,
           item2: 2,
           item5: 5,
           item4: 4,
    };
    can't initialize it that way
    You are wrong. I can init it this way using GCC. In fact, either way works on any of the GCC's that I have (I have 5).

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by Kennedy View Post
    You are wrong. I can init it this way using GCC. In fact, either way works on any of the GCC's that I have (I have 5).
    Do you have your errors and warnings turned off?

    Message 1 is absolutely not standard C .... in fact I'm surprised GCC will compile it, PellesC won't and it's pretty big on standards.

  3. #3
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    Quote Originally Posted by CommonTater View Post
    Do you have your errors and warnings turned off?

    Message 1 is absolutely not standard C .... in fact I'm surprised GCC will compile it, PellesC won't and it's pretty big on standards.
    The build system for the kernel enables _ALL_ warnings and treats all warnings as errors (at least with 2.6.36.1 this is the case -- This is something that Linus has been pushing for for many years, though I don't know when he started the warnings as errors bit and why you can see many Linus melt downs on LKML if you search for "warning bomb")

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with Realloc()
    By krazyxazn in forum C Programming
    Replies: 10
    Last Post: 01-27-2010, 10:05 PM
  2. help with structs and malloc!
    By coni in forum C Programming
    Replies: 20
    Last Post: 09-14-2009, 05:38 PM
  3. Replies: 16
    Last Post: 10-29-2006, 05:04 AM
  4. Function validation.
    By Fhl in forum C Programming
    Replies: 10
    Last Post: 02-22-2006, 08:18 AM
  5. Search Engine - Binary Search Tree
    By Gecko2099 in forum C Programming
    Replies: 9
    Last Post: 04-17-2005, 02:56 PM